#ifndef GAME_H
#define GAME_H

#include <ev.h>

class Game {
  public:
    Game();
    ~Game();

    void start(struct ev_loop *p_loop);
    void stop();

  protected:
    void askQuestion();

    void on30SecReach();
    void on20SecReach();
    void on10SecReach();
    void onStdinReadable();

    static void On30SecCallback(struct ev_loop *p_loop, ev_timer *p_w, int events);
    static void On20SecCallback(struct ev_loop *p_loop, ev_timer *p_w, int events);
    static void On10SecCallback(struct ev_loop *p_loop, ev_timer *p_w, int events);
    static void OnStdinReadCallback(struct ev_loop *p_loop, ev_io *p_w, int events);

  private:
    struct ev_loop *p_loop_;
    ev_timer timer_30sec_;
    ev_timer timer_20sec_;
    ev_timer timer_10sec_;
    ev_io stdin_read_event_;

    int right_answer_;
    int remain_question_number_;
};

#endif //GAME_H
